package com.tankGame;

import java.awt.*;

/**
 * @author LingLed
 * @version 1.0
 */
public class Square implements Wall {
    //正方形
    private int x;
    private int y;
    private int width;

    public Square(int x, int y, int width) {
        this.x = x;
        this.y = y;
        this.width = width;
    }

    public void setX(int x) {
        this.x = x;
    }

    public void setY(int y) {
        this.y = y;
    }

    public void setWidth(int width) {
        this.width = width;
    }

    @Override
    public void draw(Graphics g) {
        Color color = g.getColor();
        g.setColor(Color.WHITE);
        g.fill3DRect(x, y, width, width, true);
        g.setColor(color);
    }

    @Override
    public void destroy() {
        walls.remove(this);
    }

    @Override
    public int getX() {
        return x;
    }

    @Override
    public int getY() {
        return y;
    }

    @Override
    public int getWidth() {
        return width;
    }

    @Override
    public int getHeight() {
        return width;
    }
}
